// pages/appointment/index.js
const { appointment, wxPayment, getOpenId } = require('../../api/api.js')
const { formatTime } = require('../../utils/util.js')
const currentDate = new Date()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    topTitle: {
      top: 0,
      height: 0,
    },
    showDialog:false,
    weixinCode:'',
    money:''
  },

  goBack() {
    wx.navigateBack({
      delta: 1,
    })
  },
  openDialog(){
    this.setData({
      showDialog:true
    })
  },
  toggleDialog(){
    this.setData({
      showDialog:!this.data.showDialog,
      money:'',
      weixinCode:''
    })
  },
  confirm(){
    wx.showToast({
      title: '提现失败，请联系客服',
      icon: 'none',
      duration: 1000
    })
  },
  goServiceLogin() {
    const service = wx.getStorageSync('service-info')
    if (service) {
      try {
        const { token } = JSON.parse(service)
        if (token) {
          wx.navigateTo({
            url: '/pages/serviceOrder/index',
          })
          return
        }
      } catch (e) { }
    }
    wx.navigateTo({
      url: '/pages/serviceLogin/index',
    })
  },







  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    const {
      top,
      height
    } = wx.getMenuButtonBoundingClientRect();
    this.setData({
      topTitle: {
        top,
        height
      }
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    return {
      title: '家晓验房＠品牌验房【全国连锁更专业】',
      path: '/pages/index/index',
      imageUrl: '/assets/image/share-img.png'
    }
  }
})